/**
 * @AUTHOR 林亚军
 * @date  2013-09-24
 * @description dialog
 **/
(function($,undefined){
	var _typeUtil_=function(type,typeValue){
			if(typeof(typeValue)=="string"&&type==typeValue){
				return true;
			}
			return false;
	}
	$.widget("ui.simpleDialog",$.ui.dialog,{
		version:"0.0.1",
		options: {
			title:"",
			type:"common",
			content:null,
			src:""
				
		},
		_create:function(){
			var el=this.element,
				type=this.options.type,
				content=(this.options.content!=null&&""!=$.trim(this.options.content))?this.options.content:el.html();
			if(!el.attr("title")){
				el.attr("title",this.options.title);
			}
			if(!_typeUtil_("common",type)&&!_typeUtil_("iframe",type)){
				var _$table_=$("<table width=\"100%\" height=\"100%\"><tr><td width=\"10%\" align=\"center\" valign=\"middle\"></td><td align=\"center\" valign=\"middle\"></td></tr></table>"),
					_$imagTds_=_$table_.children().children("tr").children("td");
					var _$images_=$("<img  width=\"60\" height=\"60\"></img>");
				this.options.width=350;
				this.options.height=250;
				if(_typeUtil_("confirm",type)){
					_$images_.attr("src","style/images/dialog/confirm.png");					
					
				}else if(_typeUtil_("error",type)){
					_$images_.attr("src","style/images/dialog/error.png");
				}else if(_typeUtil_("info",type)){
					_$images_.attr("src","style/images/dialog/info.png");
				}else if(_typeUtil_("alert",type)){
					_$images_.attr("src","style/images/dialog/alert.png");
				}else if(_typeUtil_("question",type)){
					_$images_.attr("src","style/images/dialog/question.png");
				}else if(_typeUtil_("stop",type)){
					_$images_.attr("src","style/images/dialog/stop.png");
				}
					el.html(_$table_);
					$(_$imagTds_[0]).html(_$images_);
					$(_$imagTds_[1]).html(content);
			}else if(_typeUtil_("iframe",type)){
				var iframe=$("<iframe  frameborder=\"0\" width=\"100%\" height=\"100%\"></iframe>");
				el.html(iframe);
				el.css("padding","0 0 0 0px");
				iframe.attr("src",this.options.src);
 			}
 			

			
			
			$.ui.dialog.prototype._create.apply( this );
		}
		
	});
})(jQuery);